﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Model
{
    /// <summary>
    /// 数据字典数据表
    /// </summary>
    [Table("sys_dict_data")]
    public class SysDictData
    {
        /// <summary>
        /// 字典编码
        /// </summary>
        [Key]
        [Column("dict_code")]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long DictCode { get; set; }

        /// <summary>
        /// 字典排序
        /// </summary>
        [Required]
        [Column("dict_sort")]
        public int DictSort { get; set; }

        /// <summary>
        /// 字典标签
        /// </summary>
        [Required]
        [Column("dict_label")]
        [StringLength(100)]
        public string DictLabel { get; set; } = string.Empty;

        /// <summary>
        /// 字典键值
        /// </summary>
        [Required]
        [Column("dict_value")]
        [StringLength(100)]
        public string DictValue { get; set; } = string.Empty;

        /// <summary>
        /// 字典类型
        /// </summary>
        [Required]
        [Column("dict_type")]
        [StringLength(100)]
        public string DictType { get; set; } = string.Empty;

        /// <summary>
        /// 样式属性（其他样式扩展）
        /// </summary>
        [Column("css_class")]
        [StringLength(100)]
        public string? CssClass { get; set; }

        /// <summary>
        /// 表格回显样式
        /// </summary>
        [Column("list_class")]
        [StringLength(100)]
        public string? ListClass { get; set; }

        /// <summary>
        /// 是否默认（Y是 N否）
        /// </summary>
        [Required]
        [Column("is_default")]
        [StringLength(1)]
        public string IsDefault { get; set; } = "N";

        /// <summary>
        /// 状态（0正常 1停用）
        /// </summary>
        [Required]
        [Column("status")]
        [StringLength(1)]
        public string Status { get; set; } = "0";

        /// <summary>
        /// 创建者
        /// </summary>
        [Required]
        [Column("create_by")]
        [StringLength(64)]
        public string CreateBy { get; set; } = string.Empty;

        /// <summary>
        /// 创建时间
        /// </summary>
        [Required]
        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新者
        /// </summary>
        [Required]
        [Column("update_by")]
        [StringLength(64)]
        public string UpdateBy { get; set; } = string.Empty;

        /// <summary>
        /// 更新时间
        /// </summary>
        [Required]
        [Column("update_time")]
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Column("remark")]
        [StringLength(500)]
        public string? Remark { get; set; }

        /// <summary>
        /// 字典类型导航属性
        /// </summary>
        [ForeignKey("DictType")]
        public virtual SysDictType? DictTypeInfo { get; set; }
    }
}
